//
//  CircleEditBottomView.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/3.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "CircleEditBottomView.h"

@implementation CircleEditBottomView

- (id)initWithInSuperView:(UIView *)aSuperView
{
    if (self == [super initWithInSuperView:aSuperView]) {
        self.backgroundColor = [UIColor whiteColor];
        
        CGFloat heightV = kHeightProportion_In_iPhoneTriploid(49);
        CGRect newFrame = CGRectMake(0, KScreenHeight - heightV - kHeightProportion_In_iPhoneTriploid(24), KScreenWidth, heightV);
        self.frame = newFrame;
        
        GLGWView *topView = [[GLGWView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeightProportion_In_iPhoneTriploid(1)) inSuperView:self];
        topView.backgroundColor = [UIColor colorWithHexString:@"#EAEAEA"];
        
        CGFloat seleBtnX = kWidthProportion_In_iPhoneTriploid(15);
        CGFloat seleBtnY = 0;
        CGFloat seleBtnW = kWidthProportion_In_iPhoneTriploid(100);
        CGFloat seleBtnH = newFrame.size.height;
        GLGWButton *seleBtn = [[GLGWButton alloc] initWithFrame:CGRectMake(seleBtnX, seleBtnY, seleBtnW, seleBtnH) inSuperView:self];
//        [seleBtn addTarget:seleBtn action:@selector(allSelseAction:) forControlEvents:UIControlEventTouchUpInside];
        [seleBtn setImage:[UIImage imageNamed:@"goods_shoucan"] forState:UIControlStateNormal];
        [seleBtn setTitle:@"全选" forState:UIControlStateNormal];
        [seleBtn setTitleColor:kColor_Rule_Black forState:UIControlStateNormal];
        [seleBtn setImagePositionWithType:SSImagePositionTypeLeft spacing:kWidthProportion_In_iPhoneTriploid(5)];
        seleBtn.titleLabel.font = SYSTEMFONT(14);
        _seleAll = seleBtn;
        
        CGFloat seleBtn2W = kWidthProportion_In_iPhoneTriploid(100);
        CGFloat seleBtn2X = newFrame.size.width - seleBtn2W - kWidthProportion_In_iPhoneTriploid(15);
        CGFloat seleBtn2Y = 0;
        CGFloat seleBtn2H = seleBtnH;
        GLGWButton *seleBtn2 = [[GLGWButton alloc] initWithFrame:CGRectMake(seleBtn2X, seleBtn2Y, seleBtn2W, seleBtn2H) inSuperView:self];
        [seleBtn2 addTarget:self action:@selector(allDeleteAction:) forControlEvents:UIControlEventTouchUpInside];
        [seleBtn2 setImage:[UIImage imageNamed:@"goods_shoucan"] forState:UIControlStateNormal];
        [seleBtn2 setTitleColor:kColor_Rule_Black forState:UIControlStateNormal];
        seleBtn2.titleLabel.font = SYSTEMFONT(14);
        [seleBtn2 setImagePositionWithType:SSImagePositionTypeLeft spacing:kWidthProportion_In_iPhoneTriploid(5)];
        [seleBtn2 setTitle:@"删除" forState:UIControlStateNormal];
    }
    return self;
}

- (void)allDeleteAction:(GLGWButton *)sender
{
    if (self.BlockAllDelete) {
        self.BlockAllDelete(sender);
    }
}

- (void)showViewHighe
{
    [UIView animateWithDuration:0.7 animations:^{
        CGRect newFreame = self.frame;
        newFreame.origin.y -= (self.frame.size.height *2 + kHeightProportion_In_iPhoneTriploid(44));
        self.frame = newFreame;
    } completion:nil];
}

- (void)dismissViewHighe
{
    [UIView animateWithDuration:0.7 animations:^{
        CGRect newFreame = self.frame;
        newFreame.origin.y += (self.frame.size.height *2 + kHeightProportion_In_iPhoneTriploid(44));
        self.frame = newFreame;
    } completion:nil];
}

- (void)showView
{
    [UIView animateWithDuration:0.7 animations:^{
        CGRect newFreame = self.frame;
        newFreame.origin.y -= self.frame.size.height *2;
        self.frame = newFreame;
    } completion:nil];
}

- (void)dismissView
{
    [UIView animateWithDuration:0.7 animations:^{
        CGRect newFreame = self.frame;
        newFreame.origin.y += self.frame.size.height * 2;
        self.frame = newFreame;
    } completion:nil];
}

@end
